Skip to content

Conversation

@you06
Copy link
Contributor

@you06 you06 commented Jul 25, 2025

First-time contributors' checklist

What is changed, added or deleted? (Required)

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions (in Chinese).

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

What is the related PR or file link(s)?

  • This PR is translated from:
  • Other reference link(s):

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 25, 2025
follower-read.md Outdated
Follower Read 功能适用于以下场景:

- 希望通过 follower 打散读热点。
- 希望通过读取本地副本节省流量。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个“本地”是否展开解释成 “相同 zone tidb 访问 tikv“?

follower-read.md Outdated
### Follower 副本选择策略

由于 TiKV 的 Follower Read 不会破坏 TiDB 的 Snapshot Isolation 事务隔离级别,因此 TiDB 选择 follower 的策略可以采用 round robin 的方式。目前,对于 Coprocessor 请求,Follower Read 负载均衡策略粒度是连接级别的,对于一个 TiDB 的客户端连接在某个具体的 Region 上会固定使用同一个 follower,只有在选中的 follower 发生故障或者因调度策略发生调整的情况下才会进行切换。而对于非 Coprocessor 请求(点查等),Follower Read 负载均衡策略粒度是事务级别的,对于一个 TiDB 的事务在某个具体的 Region 上会固定使用同一个 follower,同样在 follower 发生故障或者因调度策略发生调整的情况下才会进行切换。如果同一事务内既有点查请求又有 Coprocessor 请求,两种请求都将按照上述调度策略分别进行读取,即使 Coprocessor 和点查出现在同一个 Region 上,TiDB 也会当作独立事件来处理。
由于 TiKV 的 Follower Read 不会破坏 TiDB 的 Snapshot Isolation 事务隔离级别,因此 TiDB 会根据 `tidb_replica_read` 选择满足要求的副本进行读取。当选中的 follower 节点出现无法访问的故障或其他错误时,会切换到 leader 提供服务。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否提一下这里的策略是第一轮请求处理,不包含后续内部 region error 处理和重试?

@ti-chi-bot ti-chi-bot bot requested a review from joey-yez July 29, 2025 09:43
Signed-off-by: you06 <[email protected]>
@qiancai qiancai added v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. translation/doing This PR’s assignee is translating this PR. for-release This PR relates to a TiDB release but does not have a tracked feature. and removed missing-translation-status This PR does not have translation status info. labels Sep 4, 2025
follower-read.md Outdated
- 当一个读请求的预估返回结果小于变量 [`tidb_adaptive_closest_read_threshold`](/system-variables.md#tidb_adaptive_closest_read_threshold-从-v630-版本开始引入) 的值时,TiDB 会选择 leader 副本执行读取操作。

- 当设置为 `learner` 时,TiDB 会选择 learner 副本执行读取操作。在读取时,如果当前 Region 没有 learner 副本,TiDB 会报错
- 当设置为 `learner` 时,TiDB 会选择 learner 副本执行读取操作。在读取时,如果当前 Region 没有 learner 副本,TiDB 会从 leader 读取数据
Copy link
Member

@lilin90 lilin90 Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看到 @zyguan 的一个 PR #20609 里是这么更新的,请 @you06 看下按哪个表述:

当设置为 learner 时,TiDB 会选择 learner 副本执行读取操作。在读取时,如果当前 Region 没有 learner 副本或 learner 副本不可用,TiDB 会从可用 leader 或 follower 副本读取数据。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#20609 的描述更加准确,可以先把 #20609 合并,我再把这个 PR 修改一下吗

@qiancai qiancai assigned qiancai and unassigned lilin90 Oct 16, 2025
@qiancai
Copy link
Collaborator

qiancai commented Oct 16, 2025

/bot-review

@github-actions
Copy link

✅ AI review completed, 15 comments generated.

@pingcap pingcap deleted a comment from github-actions bot Oct 16, 2025
@pingcap pingcap deleted a comment from github-actions bot Oct 16, 2025
@pingcap pingcap deleted a comment from github-actions bot Oct 16, 2025
@pingcap pingcap deleted a comment from github-actions bot Oct 16, 2025
@pingcap pingcap deleted a comment from github-actions bot Oct 16, 2025
@pingcap pingcap deleted a comment from github-actions bot Oct 16, 2025
@pingcap pingcap deleted a comment from github-actions bot Oct 16, 2025
@pingcap pingcap deleted a comment from github-actions bot Oct 16, 2025
Signed-off-by: you06 <[email protected]>
github-actions bot added a commit to qiancai/docs that referenced this pull request Oct 23, 2025
  Synced from: pingcap/docs-cn#20703
  Target PR: pingcap#21962
  AI Provider: gemini

  Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@qiancai qiancai added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed translation/doing This PR’s assignee is translating this PR. labels Oct 24, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 28, 2025

@joey-yez: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

qiancai and others added 2 commits October 30, 2025 13:59
Copy link
Member

@lilin90 lilin90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 30, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 30, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-10-16 04:14:26.84471498 +0000 UTC m=+326772.921967539: ☑️ agreed by qiancai.
  • 2025-10-30 07:52:16.729018314 +0000 UTC m=+1549442.806270864: ☑️ agreed by lilin90.

@qiancai
Copy link
Collaborator

qiancai commented Nov 3, 2025

/approve

@ti-chi-bot
Copy link

ti-chi-bot bot commented Nov 3, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiancai

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Nov 3, 2025
@ti-chi-bot ti-chi-bot bot merged commit ba6b686 into pingcap:master Nov 3, 2025
7 checks passed
ti-chi-bot pushed a commit to ti-chi-bot/docs that referenced this pull request Nov 3, 2025
  Synced from: pingcap/docs-cn#20703
  Target PR: pingcap#21962
  AI Provider: gemini

  Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #21041.
But this PR has conflicts, please resolve them!

ti-chi-bot pushed a commit to ti-chi-bot/docs-cn that referenced this pull request Nov 3, 2025
qiancai added a commit that referenced this pull request Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved for-release This PR relates to a TiDB release but does not have a tracked feature. lgtm needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants